#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 3e4 + 10;
typedef long long ll;
ll w, n;
ll a[N];
int main()
{
    cin >> w >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    int i = 1;
    int l = n;
    ll ret = 0;
    while (i <= l)
    {
        if (a[i] + a[l] <= w)
        {
            i++;
            l--;
        }
        else
        {
            l--;
        }
        ret++;
    }
    cout << ret << endl;
    return 0;
}